package cl.pelu.frames.model;

import java.util.ArrayList;

import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

import cl.pelu.model.bo.dvo.TablaDVO;

public class ArrayListComboBoxModel extends AbstractListModel implements ComboBoxModel {
	 
	  /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	  private Object selectedItem = " seleccione ";
	
	  private ArrayList<TablaDVO> anArrayList;
	  public ArrayListComboBoxModel(ArrayList arrayList) {
	    anArrayList = arrayList;
	  }
	  public Object getSelectedItem() {
		  return selectedItem;
	  }
	  public void setSelectedItem(Object newValue) {
	    selectedItem = newValue;
	  }
	  public int getSize() {
	    return anArrayList.size();
	  }
	  public Object getElementAt(int i) {
	    return anArrayList.get(i).getNombre();
	  }

	  public Object getIdAt(int i ) {
		    return anArrayList.get(i).getIdentificador();
		  
	  }
	  
	  
	  
	  
	  
	  
}
